<?php
/*$var = '10/31/2012';
$date = str_replace('/', '-', $var);
echo date('d-m-Y', strtotime($date));
$originalDate = "10-31-2013";
$newDate = date("d-m-Y", strtotime($originalDate));
echo $newDate;*/
$mydate = '10/31/2012';

//Date formated as dd/mm/yyyy
list($d, $m, $y) = preg_split('/\//', $mydate);

$mydate = sprintf('%02d%02d%4d', $d, $m, $y);
print $mydate;jghjhjhghj
?>